import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class PaperSelection {
    private final Map<Paper, Student> selections;

    public PaperSelection() {
        this.selections = new ConcurrentHashMap<>();
    }

    public boolean addSelection(Student student, Paper paper) {
        if (selections.containsKey(paper)) {
            return false;
        }
        selections.put(paper, student);
        return true;
    }

    public boolean isSelected(Paper paper) {
        return selections.containsKey(paper);
    }

    public Map<Paper, Student> getSelections() {
        return Collections.unmodifiableMap(selections);
    }

    public void accept(Visitor visitor) {
        visitor.visit(this);
    }
}    